package com.example.util;

import java.io.Serializable;

public class NumList implements Serializable{
	int count;
	int[] numArray;
	public NumList(int count) {
		this.count = count;
		numArray = new int[this.count];
	}
	
	public NumList(String numStr) {
		String[] numStrArray = numStr.split(" ");
		this.count = numStrArray.length;
		numArray = new int[this.count];
		for(int i = 0;i<count;i++) {
			numArray[i] = Integer.parseInt(numStrArray[i]);
		}
	}
	
	public void setNumOfIndex(int index, int num) {
		numArray[index] = num;
	}
	
	public int getNumOfIndex(int index) {
		return numArray[index];
	}
	
	public String toString() {
		StringBuilder  sb = new StringBuilder();
		for(int i=0;i<count-1;i++) {
			sb.append(numArray[i]);
			sb.append(" ");
		}
		sb.append(numArray[count-1]);
		return sb.toString();
		
	}

	
}
